package io;
//字符转换流 写出文件数据
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;

public class OSWDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("osw.txt");
        OutputStreamWriter osw=new OutputStreamWriter(fos,StandardCharsets.UTF_8);
        String line="新的一天,我还要努力!";
        osw.write(line);
        osw.write("也许会更好.一定会更好");
        System.out.println("写出完毕!");
        osw.close();
//        byte[]data=line.getBytes(StandardCharsets.UTF_8);
//       fos.write(data);
     //   System.out.println("写出完毕!");
//        fos.close();
    }
}
